home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / examine.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  4KB  |  169 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: examine.c,v 1.6 1996/10/24 15:50:27 aros Exp $
  4.     $Log: examine.c,v $
  5.     Revision 1.6  1996/10/24 15:50:27  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.5  1996/09/13 17:50:06  digulla
  9.     Use IPTR
  10.  
  11.     Revision 1.4  1996/08/13 13:52:45  digulla
  12.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  13.     Replaced AROS_LA by AROS_LHA
  14.  
  15.     Revision 1.3  1996/08/12 14:20:38  digulla
  16.     Added aliases
  17.  
  18.     Revision 1.2  1996/08/01 17:40:50  digulla
  19.     Added standard header for all files
  20.  
  21.     Desc:
  22.     Lang: english
  23. */
  24. #include <exec/memory.h>
  25. #include <clib/exec_protos.h>
  26. #include <dos/filesystem.h>
  27. #include <dos/exall.h>
  28. #include "dos_intern.h"
  29.  
  30. /*****************************************************************************
  31.  
  32.     NAME */
  33.     #include <clib/dos_protos.h>
  34.  
  35.     AROS_LH2(BOOL, Examine,
  36.  
  37. /*  SYNOPSIS */
  38.     AROS_LHA(BPTR,                   lock, D1),
  39.     AROS_LHA(struct FileInfoBlock *, fib,  D2),
  40.  
  41. /*  LOCATION */
  42.     struct DosLibrary *, DOSBase, 17, Dos)
  43.  
  44. /*  FUNCTION
  45.  
  46.     INPUTS
  47.  
  48.     RESULT
  49.  
  50.     NOTES
  51.  
  52.     EXAMPLE
  53.  
  54.     BUGS
  55.  
  56.     SEE ALSO
  57.  
  58.     INTERNALS
  59.  
  60.     HISTORY
  61.     29-10-95    digulla automatically created from
  62.                 dos_lib.fd and clib/dos_protos.h
  63.  
  64. *****************************************************************************/
  65.  
  66. /*****************************************************************************
  67.  
  68.     NAME
  69.     #include <clib/dos_protos.h>
  70.  
  71.     AROS_LH2(BOOL, ExamineFH,
  72.  
  73.     SYNOPSIS
  74.     AROS_LHA(BPTR                  , fh, D1),
  75.     AROS_LHA(struct FileInfoBlock *, fib, D2),
  76.  
  77.     LOCATION
  78.     struct DosLibrary *, DOSBase, 65, Dos)
  79.  
  80.     FUNCTION
  81.  
  82.     INPUTS
  83.  
  84.     RESULT
  85.  
  86.     NOTES
  87.  
  88.     EXAMPLE
  89.  
  90.     BUGS
  91.  
  92.     SEE ALSO
  93.  
  94.     INTERNALS
  95.  
  96.     HISTORY
  97.     29-10-95    digulla automatically created from
  98.                 dos_lib.fd and clib/dos_protos.h
  99.  
  100. *****************************************************************************/
  101. /*AROS alias ExamineFH Examine */
  102. {
  103.     AROS_LIBFUNC_INIT
  104.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  105.  
  106.     UBYTE buffer[512];
  107.     struct ExAllData *ead=(struct ExAllData *)buffer;
  108.     STRPTR src, dst;
  109.     ULONG i;
  110.  
  111.     /* Get pointer to filehandle */
  112.     struct FileHandle *fh=(struct FileHandle *)BADDR(lock);
  113.  
  114.     /* Get pointer to process structure */
  115.     struct Process *me=(struct Process *)FindTask(NULL);
  116.  
  117.     /* Get pointer to I/O request. Use stackspace for now. */
  118.     struct IOFileSys io,*iofs=&io;
  119.  
  120.     /* Prepare I/O request. */
  121.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  122.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  123.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  124.     iofs->IOFS.io_Device =fh->fh_Device;
  125.     iofs->IOFS.io_Unit     =fh->fh_Unit;
  126.     iofs->IOFS.io_Command=FSA_EXAMINE;
  127.     iofs->IOFS.io_Flags  =0;
  128.     iofs->io_Args[0]=(IPTR)buffer;
  129.     iofs->io_Args[1]=512;
  130.     iofs->io_Args[2]=ED_OWNER;
  131.  
  132.     /* Send the request. */
  133.     DoIO(&iofs->IOFS);
  134.  
  135.     /* Set error code and return */
  136.     if((me->pr_Result2=iofs->io_DosError))
  137.     return 0;
  138.     else
  139.     {
  140.     fib->fib_DiskKey=0;
  141.     fib->fib_DirEntryType=ead->ed_Type;
  142.     src=ead->ed_Name;
  143.     dst=fib->fib_FileName;
  144.     if(src!=NULL)
  145.         for(i=0;i<107;i++)
  146.         if(!(*dst++=*src++))
  147.             break;
  148.     *dst++=0;
  149.     fib->fib_Protection=ead->ed_Prot^0xf;
  150.     fib->fib_EntryType=ead->ed_Type;
  151.     fib->fib_Size=ead->ed_Size;
  152.     fib->fib_Date.ds_Days=ead->ed_Days;
  153.     fib->fib_Date.ds_Minute=ead->ed_Mins;
  154.     fib->fib_Date.ds_Tick=ead->ed_Ticks;
  155.     src=ead->ed_Comment;
  156.     dst=fib->fib_Comment;
  157.     if(src!=NULL)
  158.         for(i=0;i<79;i++)
  159.         if(!(*dst++=*src++))
  160.             break;
  161.     *dst++=0;
  162.     fib->fib_OwnerUID=ead->ed_OwnerUID;
  163.     fib->fib_OwnerGID=ead->ed_OwnerGID;
  164.     return 1;
  165.     }
  166.  
  167.     AROS_LIBFUNC_EXIT
  168. } /* Examine */
  169.